类型修改
类型修改
ndarray.astype(type)
- 返回修改了类型之后的数组
a1.astype(np.int32) # 将数组的元素类型修改为int32
ndarray.tostring([order])
或者 ndarray.tobytes([order])
- 构造包含数组中原始数据字节的python字节
a1.tostring()
ndarray.astype(type)
a1.astype(np.int32) # 将数组的元素类型修改为int32
ndarray.tostring([order])
或者 ndarray.tobytes([order])
a1.tostring()